#pragma once
#include "reactor/noncopyable.hpp"
#include <vector>
#include <memory>

namespace reactor {
class EventLoop;
class EventLoopThread;

/**
 * @brief IO 线程池
 */
class EventLoopThreadPool : noncopyable {
public:
    EventLoopThreadPool(EventLoop* baseLoop);
    ~EventLoopThreadPool();

    void setThreadNum(int numThreads) { _numThreads = numThreads; }
    void start();
    EventLoop* getNextLoop();

private:
    EventLoop* _baseLoop;
    bool _started;
    int _numThreads;
    int _next;
    std::vector<std::unique_ptr<EventLoopThread>> _threads;
    std::vector<EventLoop*> _loops;
};
} // namespace reactor
